const app = getApp();
const http = require('../../../utils/http.js');
Page({
  data: {
    active:0,
    titleIcon: 'https://huixuangou.oss-cn-beijing.aliyuncs.com/wechat/Xz_MiNi_image/icon_me_jiantou_down@2x.png',
    titleList: '',
    orderList: '',
    NetWorkStatus:true,
    backIcon:'http://oss.myzy.com.cn/wechat/images/goback.png',
    homeIcon:''
  },
  onLoad: function (options) {
    var query = wx.createSelectorQuery();
    //选择id
    var that = this;
    that.setData({
      homeIcon:options.type?'https://huixuangou.oss-cn-beijing.aliyuncs.com/wechat/Xz_MiNi_image/home_tab_icon_home_def%402x.png':'',
      backIcon:options.type?'':'http://oss.myzy.com.cn/wechat/images/goback.png',
    })
    query.select('#pageTitle').boundingClientRect(function (rect) {
      console.log(rect)
      that.setData({
        height: rect.height + 'px'
      })
    }).exec();
    wx.getNetworkType({
      complete: (res) => {
        console.log(res)
        if (res.networkType == 'none') {
          that.setData({
            NetWorkStatus: false
          })
        }
      },
    })
  },
  onAgainLoadingTap(){
    wx.showToast({
      title: '加载中',
      icon:'loading'
    })
    this.tabar.onOrderList(this.data.active,'')
  },
  onActiveClick(e) {
    var _this = this,
      id = e.currentTarget.id
    _this.setData({
      active: id
    })
    _this.tabar.onOrderList(id,-1)
    console.log(_this)
  },
  onReady: function () {
    this.tabar = this.selectComponent("#tabar");
    this.tabar.onOrderList(this.data.active,-1)
  },
  onShow: function () {},
  onHide: function () {},
  onUnload: function () {},
  onPullDownRefresh: function () {},
  onReachBottom: function () {},
  onShareAppMessage: function () {}
})